/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg_entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Oswaldo
 */
@Entity
@Table(name = "susr_usuario", catalog = "sisventas_db", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"),
    @NamedQuery(name = "Usuario.findByUsrCodigo", query = "SELECT u FROM Usuario u WHERE u.usrCodigo = :usrCodigo"),
    @NamedQuery(name = "Usuario.findByUsrCorreo", query = "SELECT u FROM Usuario u WHERE u.usrCorreo = :usrCorreo"),
    @NamedQuery(name = "Usuario.findByUsrPasswd", query = "SELECT u FROM Usuario u WHERE u.usrPasswd = :usrPasswd"),
    @NamedQuery(name = "Usuario.findByUsrSeudonim", query = "SELECT u FROM Usuario u WHERE u.usrSeudonim = :usrSeudonim"),
    @NamedQuery(name = "Usuario.findByUsrApellidos", query = "SELECT u FROM Usuario u WHERE u.usrApellidos = :usrApellidos"),
    @NamedQuery(name = "Usuario.findByUsrNombres", query = "SELECT u FROM Usuario u WHERE u.usrNombres = :usrNombres"),
    @NamedQuery(name = "Usuario.findByUsrEmpresa", query = "SELECT u FROM Usuario u WHERE u.usrEmpresa = :usrEmpresa")})
public class Usuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "usr_codigo")
    private Integer usrCodigo;
    @Size(max = 42)
    @Column(name = "usr_correo")
    private String usrCorreo;
    @Size(max = 42)
    @Column(name = "usr_passwd")
    private String usrPasswd;
    @Size(max = 25)
    @Column(name = "usr_seudonim")
    private String usrSeudonim;
    @Size(max = 42)
    @Column(name = "usr_apellidos")
    private String usrApellidos;
    @Size(max = 42)
    @Column(name = "usr_nombres")
    private String usrNombres;
    @Size(max = 42)
    @Column(name = "usr_empresa")
    private String usrEmpresa;
    @OneToMany(mappedBy = "usrCodigo")
    private List<Artiserv> artiservList;
    @OneToMany(mappedBy = "usrCodigo")
    private List<Operacion> operacionList;
    @OneToMany(mappedBy = "usrCodigo")
    private List<Preguntas> preguntasList;
    @OneToMany(mappedBy = "usrCodigo")
    private List<Sucursal> sucursalList;

    public Usuario() {
    }

    public Usuario(Integer usrCodigo) {
        this.usrCodigo = usrCodigo;
    }

    public Integer getUsrCodigo() {
        return usrCodigo;
    }

    public void setUsrCodigo(Integer usrCodigo) {
        this.usrCodigo = usrCodigo;
    }

    public String getUsrCorreo() {
        return usrCorreo;
    }

    public void setUsrCorreo(String usrCorreo) {
        this.usrCorreo = usrCorreo;
    }

    public String getUsrPasswd() {
        return usrPasswd;
    }

    public void setUsrPasswd(String usrPasswd) {
        this.usrPasswd = usrPasswd;
    }

    public String getUsrSeudonim() {
        return usrSeudonim;
    }

    public void setUsrSeudonim(String usrSeudonim) {
        this.usrSeudonim = usrSeudonim;
    }

    public String getUsrApellidos() {
        return usrApellidos;
    }

    public void setUsrApellidos(String usrApellidos) {
        this.usrApellidos = usrApellidos;
    }

    public String getUsrNombres() {
        return usrNombres;
    }

    public void setUsrNombres(String usrNombres) {
        this.usrNombres = usrNombres;
    }

    public String getUsrEmpresa() {
        return usrEmpresa;
    }

    public void setUsrEmpresa(String usrEmpresa) {
        this.usrEmpresa = usrEmpresa;
    }

    @XmlTransient
    public List<Artiserv> getArtiservList() {
        return artiservList;
    }

    public void setArtiservList(List<Artiserv> artiservList) {
        this.artiservList = artiservList;
    }

    @XmlTransient
    public List<Operacion> getOperacionList() {
        return operacionList;
    }

    public void setOperacionList(List<Operacion> operacionList) {
        this.operacionList = operacionList;
    }

    @XmlTransient
    public List<Preguntas> getPreguntasList() {
        return preguntasList;
    }

    public void setPreguntasList(List<Preguntas> preguntasList) {
        this.preguntasList = preguntasList;
    }

    @XmlTransient
    public List<Sucursal> getSucursalList() {
        return sucursalList;
    }

    public void setSucursalList(List<Sucursal> sucursalList) {
        this.sucursalList = sucursalList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usrCodigo != null ? usrCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usuario)) {
            return false;
        }
        Usuario other = (Usuario) object;
        if ((this.usrCodigo == null && other.usrCodigo != null) || (this.usrCodigo != null && !this.usrCodigo.equals(other.usrCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return usrApellidos + ' ' + usrNombres;
    }
    
}
